<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script>
    (function () {
        var socket = new WebSocket("ws://127.0.0.1:8080");
        socket.onopen = function(ev){
            console.log("连接简历成功")
            socket.send("你好，我是张三");
        };
        socket.onmessage = function(ev){
            var data = ev.data;
            console.log(data.toString())
        };
        socket.onerror = function (ev) {
            console.log(ev)
        }
    })();
</script>
</html>